home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_200 / 241_01 / inferenc.doc < prev    next >
Text File  |  1987-08-29  |  46KB  |  1,189 lines

  1.         INFERENCE          -- SOFTMAN ENTERPRIZES --        Dec. 30, 1985
  2.  
  3.  
  4.         INTRODUCTION: 
  5.  
  6.         The  software contained in this distribution is copyright (C)  by 
  7.         George   Hageman   1985   and  is  released   into   the   public               
  8.         domain with the following restrictions:                         
  9.  
  10.              (1)   This  software  is intended  for  non-commertial usage.                                              
  11.              (2)    I   am   held  save  from  damages   resulting   from               
  12.              its use, and
  13.              (3)   The following concepts and legal jargon are agreed  to 
  14.              by the user of this software.
  15.  
  16.              User-supported software concept:
  17.  
  18.                   IF          you find use for this software
  19.                   ANDIF       it saves you some development time
  20.                   THEN            send me $10.00
  21.                   ANDTHENHYP      you will feel good!
  22.  
  23.         This source code is provided on an "as is" basis without warranty 
  24.         of any kind,  expressed or implied,  including but not limited to 
  25.         the  implied  warranties  of merchantability and  fitness  for  a 
  26.         particular   purpose.    The  entire  risk  as  to  quality   and 
  27.         performance  of this software is with you.   Should the  software 
  28.         prove  defective,  you  assume the entire cost of  all  necessary 
  29.         repair, servicing, or correction.  In no event will the author be 
  30.         liable to you for any damages,  including any lost profits,  lost 
  31.         savings, or other incidental or consequential damages arising out 
  32.         of  the   use  of inability to use this software.   In  short  my 
  33.         friends,  I  have done  a reasonable amount of work in  debugging 
  34.         this  software and I think it is pretty good but,  as  you  know, 
  35.         there  is always some chance that a bug is still lurking  around. 
  36.         If you should happen to be lucky enough to  find one,  please let 
  37.         me know so I    can make an attempt to fix it.          
  38.  
  39.              The  following  is  a short description of how  to  use  the 
  40.         inference  engine  and rule-compiler contained in  this  software 
  41.         release.    The source and object files for the rule compiler and 
  42.         the inference engine are contained in the files  named  *.?R  and
  43.         *.?I, respectively.   There  are  common files in  each  library.  
  44.         These  common  files  are header files which are used  to  define 
  45.         common terms between the different sources.    The most important 
  46.         header file is the file named "expert.h" which not only  contains 
  47.         common  definitions  used  between  the  rule  compiler  and  the 
  48.         inference  engine,  but has a short description of their usage as 
  49.         well.    This inference engine, and its associated rule compiler, 
  50.         represents  a  significant  time investment for  me,  so  if  you 
  51.         believe in the  shareware concept please remember my address.
  52.  
  53.                             George W. Hageman
  54.                             P.O. Box 11234
  55.                             Boulder, Colorado  80301
  56.  
  57.  
  58.  
  59.  
  60.  
  61.         George W. Hageman            --1--
  62.  
  63.  
  64.  
  65.  
  66.  
  67.         INFERENCE          -- SOFTMAN ENTERPRIZES --        Dec. 30, 1985
  68.  
  69.  
  70.              This  software compiles using the Microsoft C  Compiler  Rev 
  71.         3.0  using the make function which comes with the Microsoft Macro 
  72.         Assembler Rev.  4.0.  I have nothing but good things to say about 
  73.         these  two products and suggest that you consider their  purchase 
  74.         if  you are into serious software development for the  PC.   This 
  75.         software  also compiles and runs under UNIX system  V.   Use  the 
  76.         UNIXSV  flag  in the makefile or use a -DUNIXSV when you  compile 
  77.         it.
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.         George W. Hageman            --2--
  128.  
  129.  
  130.  
  131.  
  132.  
  133.         INFERENCE          -- SOFTMAN ENTERPRIZES --        Dec. 30, 1985
  134.  
  135.  
  136.         INFERENCE ENGINES:
  137.  
  138.              An  inference engine is merely a program which  attempts  to 
  139.         prove consequents given a certain set of antecedents and a set of 
  140.         rules  which define the TRUTH or FALSEness of each consequent  in 
  141.         terms  of the antecedents.     The consequents,  antecedents  and 
  142.         rules  for  this  inference engine are contained in a  text  file 
  143.         which is compiled by the rule-compiler into a form the  inference 
  144.         engine  can understand.   Often these two functions are contained 
  145.         in the same executeable,  but I have decided to split them up  to 
  146.         make the inference engine as small as possible.
  147.  
  148.              Rules  are collections of ANTECEDENTS and CONSEQUENTS formed 
  149.         into  TRUTH statements.   Each rule is an attempt state that  "If 
  150.         all of the antecedents for this particular RULE are  TRUE,   then 
  151.         all  of the consequents connected to this rule are TRUE.   If one 
  152.         or  more  of the antecedents for a RULE are  FALSE,  then  it  is 
  153.         assumed that this rule cannot prove the TRUTH of the consequents, 
  154.         but  this does not necessarily prove the consequents FALSE  since 
  155.         some  other rule may prove them TRUE."  Rules must have at  least 
  156.         one  ANTECEDENT  and  at least one CONSEQUENT  to  be  considered 
  157.         valid. 
  158.  
  159.              Each   ANTECEDENT  and  CONSEQUENT  is  a  simple  statement 
  160.         consisting  of  a  leading  KEYWORD,   and  a  FOLLOWING  STRING.  
  161.         KEYWORDS tell the inference engine what the FOLLOWING STRING will 
  162.         mean or what is to be done with it.  The FOLLOWING STRINGs may be 
  163.         either  in upper or lower case and are either statements such  as 
  164.         "THE  ANIMAL IS A BAT",  or,  a pathname to an executeable  which 
  165.         will  be loaded and executed depending on what is defined by  the 
  166.         KEYWORD. Strings, except for the number of leading blanks, can be 
  167.         considered equal only if they are identical.  The reason for this 
  168.         rule  will  become  apparent later.   An example  of  a  pathname 
  169.         FOLLOWING STRING is "/b1/hageman/expert/storm/gt_3200  data.fil".  
  170.         Note  that  the strings denoting pathnames should be  exactly  as 
  171.         they  would  be if the pathname were to be given at  a  terminal, 
  172.         also,  you  may  include  parameters with  any  pathname.   These 
  173.         parameters  are no different than the parameters that  you  would 
  174.         use  if  you  were initiating the executeable from  the  terminal 
  175.         rather than via the inference engine.    Under MS_DOS these  path 
  176.         names  can  either  be  upper or lower case,  and  for  the  UNIX 
  177.         operating system, they must correspond to the exact path name.
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.         George W. Hageman            --3--
  194.  
  195.  
  196.  
  197.  
  198.  
  199.         INFERENCE          -- SOFTMAN ENTERPRIZES --        Dec. 30, 1985
  200.  
  201.  
  202.         QUICK AND DIRTY:
  203.  
  204.              Impatient?   Well  here  are some quick ways to get  started 
  205.         with the inference engine,  leave all that reading till later!
  206.  
  207.         ONE:
  208.  
  209.              Use  your  text  editor (WS in the  Non-document  mode  only 
  210.         Please) to create a quick rule file,  or use the animals  example 
  211.         contained in this release.   Skip to the next page if you want to 
  212.         find out what the KEYWORDS are and how to use them.
  213.  
  214.         TWO:
  215.  
  216.              Compile the rules with the rule-compiler by typing..
  217.  
  218.              rulecomp inputfile outputfile 
  219.  
  220.              where  the inputfile is the filename of the file  containing 
  221.         your  rules,  and the outputfile is the file inwhich you want the 
  222.         compiled rules to be written to.  Caution, the rule compiler does 
  223.         not  check  for the equivalence of the inputfile  and  outputfile 
  224.         filenames,   if they are identical you will probably have to type 
  225.         in your r